if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var _st = window.setTimeout; 
window.setTimeout = function(fRef, mDelay) {
    if(typeof fRef == "function") { 
        var argu = Array.prototype.slice.call(arguments,2);
        var f = (function(){ fRef.apply(null, argu); });
        return _st(f, mDelay);
    }
    return _st(fRef,mDelay);
}

function addListener(obj, eventName, listener) {
	if(obj.addEventListener) {
		obj.addEventListener(eventName, listener, false);
	} else {
		obj.attachEvent("on" + eventName, listener);
	}
}
function finishedLoad() {
	document.getElementById('loading_page').style.display = "none";
}

function root_page(page_url){
	window.open(page_url, '_self');
}

function change_tab(value) {
	var element = document.getElementById("tab");
	var loading = element.getElementsByTagName('div')[0];
	var label = element.getElementsByTagName('label');
	loading.style.display = "";
	function f_load(label,loading) {
		for (var i = 0; i < label.length; i++) {
			var s_display = "none";
			var s_class = "";
			if (i==value) {
				s_display = "";
				s_class = "show";
			}
			label[i].className = s_class;
			label[i].getElementsByTagName('div')[0].style.display = s_display;
		}
		loading.style.display = "none";
	}
	setTimeout(f_load,250,label,loading);
}

function change_product(value) {
	var element = document.getElementById("product_tab");
	var dd = element.getElementsByTagName('dd');
	var loading = dd[0];
	loading.style.display = "";
	function f_load(dd,loading) {
		for (var i = 0; i < dd.length; i++) {
			var s_display = "none";
			if (i==value)
				s_display = "";
			dd[i].style.display = s_display;
		}
	}
	setTimeout(f_load,250,dd,loading);
}

function product_img(url_img, url_loading) {
	var element = document.getElementById("img_main");
	if (element.src!=url_img) {
	element.src = url_loading;
		function f_load(element,url_img) {
			element.src = url_img;
		}
		setTimeout(f_load,250,element,url_img);
	}
}

function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}
